<template>
  <app-loading ref="loadingRef"/>
  <router-view />
</template>

<script setup lang="ts">
import AppLoading from '@/components/Common/AppLoading.vue'
import { useAppStore } from '@/store/app.ts'
import { useRouter } from 'vue-router'

const appStore = useAppStore()
const router = useRouter()

appStore.initApp()

router.beforeEach((to, from, next) => {
  appStore.isLoading = true
  next()
})

router.afterEach(() => {
  appStore.isLoading = false
})
</script>

<style lang="scss">
@use '@/styles/index.module.scss';
</style>
